﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GSM.BusinessLayer;
using GSM.BusinessLayer.DataLayer;

namespace CRM_SMS_MARKETING.BL
{
    class BLLTemplate
    {
        TemplateSql templatesql;

        public BLLTemplate()
        {
            templatesql = new TemplateSql();
        }
        public List<Template> GetAllTemplate()
        {
            List<Template> list = new List<Template>();
            list= templatesql.SelectAll();
            return list;
        }
        public List<Template> GetAllTemplateByField(string field, object value)
        {
            List<Template> list = new List<Template>();
            list = templatesql.SelectByField(field, value);
            return list;
        }
        public void Insert(Template template)
        {
            templatesql.Insert(template);
        }
        public void Update(Template template)
        {
            templatesql.Update(template);
        }
        public void Delete(int ID)
        {
            Template temp = new Template();
            TemplateKeys keys = new TemplateKeys(ID);
            temp = templatesql.SelectByPrimaryKey(keys);
            temp.Deleted = true;
            templatesql.Update(temp);
        }


    }
}
